extends "../gaoxiong-2/gaoxiong-2.gd"

func _extInit():
	._extInit()
	attInfox.spd += 0.3
	lv = 3             #等级的设置
	addSkill("本场战斗内造成炮击伤害时会吸收该单位15%的雷击、炮击、射速、暴击、护甲为己用，每个角色只能吸一次", "武勋")
	
var suckCha = []	
func _onAtkChara(atkInfo):
	._onAtkChara(atkInfo)
	if atkInfo.atkType == sys.AtkType.GUN and not suckCha.has(atkInfo.hitCha) and not atkInfo.hitCha.isSumm:
		var cha = atkInfo.hitCha
		suckCha.append(cha)
		var bf = hasBuff("b_gx_wuXun")
		if bf == null:
			castBuff(self, b_gx_wuXun.new(cha))
		else:
			bf.att.atk += cha.att.atk*0.15
			bf.att.mgiAtk += cha.att.mgiAtk*0.15
			bf.att.def += cha.att.def*0.15
			bf.att.cri += cha.att.cri*0.15
			bf.att.spd += cha.att.spd*0.15
			bf.att.maxHp += cha.att.maxHp*0.1
		castBuff(cha, b_wx_sub.new())	

func _onBattleStart():
	._onBattleStart()
	suckCha = []

class b_gx_wuXun:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var cha = null
	func _init(cha):
		attInit()
		id = "b_gx_wuXun"	
		buffName = "武勋"
		dispel = 2
		att.atk += cha.att.atk*0.15
		att.mgiAtk += cha.att.mgiAtk*0.15
		att.def += cha.att.def*0.15
		att.cri += cha.att.cri*0.15
		att.spd += cha.att.spd*0.15
		self.cha = cha
	func _connect():
		att.maxHp += cha.att.maxHp*0.1

#武勋-Debuff
class b_wx_sub:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var p = 0
	func _init(p = -0.25):
		attInit()
		buffName = "武勋-负面"
		id = "b_wx_sub"		
		isNegetive = true
		self.p = p
	func _connect():
		att.atk += -p * masCha.attInfox.atk
		att.mgiAtk += -p * masCha.attInfox.atk
		att.def += -p * masCha.attInfox.atk
		att.cri += -p * masCha.attInfox.cri
		att.spd += -p * masCha.attInfox.spd
		if casCha.upgraded == 1:
			att.maxHpL = -0.1